﻿package com.schimanek.text 
{	
	import flash.text.Font;
	import flash.text.FontType;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	/**
	 * ...
	 * @author Gregor Schimanek
	 */
	public class EasyTextField extends TextField
	{
		private	var _textFormat:TextFormat;			
		private var _color:uint;
		private var _leading:Number;
		
		//[Embed(source='../../assets/IBMHelvCond2004-Regular.otf', fontName='_ibmCondRegular', mimeType = 'application/x-font' )]
		
		
		public function EasyTextField(text:String,fontName:String="_sans",size:Number=11,color:uint=0, width:Number=0,autoSize:String="left") 
		{			
			if (fontName != "_sans" && fontName != "_serif") {
				embedFonts = true;
			}
			
			this.width = width;
			
			if (width > 0) {
				wordWrap = true;
				multiline = true;
				
			}
			_color = color;
			
			
			textFormat = new TextFormat(fontName, size, color);			
			
			this.autoSize = autoSize
			this.text = text;
			
			selectable = false;			
			
		}		
		
		public function get color():uint { return _color; }
		
		public function set color(value:uint):void 
		{
			_color = value;
			
		}
		
		public function get leading():Number { return _leading; }
		
		public function set leading(value:Number):void 
		{
			_leading = value;
		}
		
		public function get textFormat():TextFormat { return _textFormat; }
		
		public function set textFormat(value:TextFormat):void 
		{
			_textFormat = value;
			defaultTextFormat = _textFormat;
		}
	}
	
}